Imports CapaDeDatos

Public Class nAlerta
    Dim Alerta As CapaDeDatos.dAlerta = New CapaDeDatos.dAlerta
    Public Function Insertar(ByVal Origen As String, _
                            ByVal Referencia As String, _
                         ByVal FechaIncial As String, _
                         ByVal FechaVencimiento As String, _
                         ByVal Estado As String, _
                         ByVal Repeticion As String, _
                         ByVal CodigoUnRep As String) As Boolean
        Return Alerta.Insertar(Origen, _
                            Referencia, _
                          FechaIncial, _
                          FechaVencimiento, _
                          Estado, _
                          Repeticion, _
                          CodigoUnRep)
    End Function
    Public Function Eliminar(ByVal CodigoAlerta As String) As Boolean
        Return Alerta.Eliminar(CodigoAlerta)
    End Function
    Public Function BuscarFiltrado(ByVal CodigoAlerta As String, _
                                    ByVal Origen As String, _
                                    ByVal Referencia As String, _
                                    ByVal FechaInicial As String, _
                                    ByVal FechaInicialMIN As String, _
                                    ByVal FechaInicialMAX As String, _
                                    ByVal FechaVencimiento As String, _
                                    ByVal Estado As String, _
                                    ByVal Repeticion As String, _
                                    ByVal CodigoUnRep As String) As DataSet
        Return Alerta.BuscarFiltrado(CodigoAlerta, _
                                        Origen, _
                                        Referencia, _
                                        FechaInicial, _
                                        FechaInicialMIN, _
                                        FechaInicialMAX, _
                                        FechaVencimiento, _
                                        Estado, _
                                        Repeticion, _
                                        CodigoUnRep)
    End Function
    Public Function Modificar(ByVal CodigoAlerta As String, _
                                    ByVal Origen As String, _
                                    ByVal Referencia As String, _
                                    ByVal FechaInicial As String, _
                                    ByVal FechaVencimiento As String, _
                                    ByVal Estado As String, _
                                    ByVal Repeticion As String, _
                                    ByVal CodigoUnRep As String) As Boolean
        Return Alerta.Modificar(CodigoAlerta, _
                                        Origen, _
                                        Referencia, _
                                        FechaInicial, _
                                        FechaVencimiento, _
                                        Estado, _
                                        Repeticion, _
                                        CodigoUnRep)
    End Function
    Public Function ModificarEstado(ByVal CodigoAlerta As String, _
                                    ByVal Estado As String) As Boolean
        Return Alerta.ModificarEstado(CodigoAlerta, Estado)
    End Function
    Public Function CambiaaVencimiento(ByVal Fecha As String) As Boolean

        Dim DtsAlertas As DataSet
        DtsAlertas = Alerta.BuscarFiltrado("", "", "", "", "", "", Fecha, "OK", "", "")
        Dim I As Integer
        For I = 0 To DtsAlertas.Tables(0).Rows.Count - 1
            Try
                Alerta.ModificarEstado(DtsAlertas.Tables(0).Rows(I)("CodigoAlerta"), "VENCIDO")
                CambiaaVencimiento = True
            Catch ex As Exception
                CambiaaVencimiento = False
            End Try
        Next


    End Function
End Class



